package com.amgl.amupush.base;

import android.support.v4.app.Fragment;
import android.widget.Toast;

import com.amgl.amupush.application.AmuApplication;
import com.amgl.amupush.utils.AmuUtils;
import com.squareup.leakcanary.RefWatcher;

/**
 * Created by amglh on 2016/8/5.
 */
public class BaseFragment extends Fragment {

    @Override
    public void onDestroy() {
        super.onDestroy();
        RefWatcher refWatcher = AmuApplication.getInstance().getRefWatcher();
        if (refWatcher != null)
            refWatcher.watch(this);
    }

    protected void showToast(String message, @AmuUtils.Duration int length) {
        if (getActivity() != null) {
            AmuUtils.showToast(getActivity(), message, length);
        }
    }

    /**
     * 显示提示
     *
     * @param message
     */
    protected void showToast(String message) {
        showToast(message, Toast.LENGTH_SHORT);
    }
}
